<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- container.qdoc -->
  <title>QDesignerContainerExtension 类 | Qt设计师手册</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td ><a href="../qtdoc/index.html">Qt 5.12</a></td><td ><a href="qtdesigner-manual.html">Qt设计师手册</a></td><td ><a href="qtdesigner-module.html">C++ 类</a></td><td >QDesignerContainerExtension</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="qtdesigner-manual.html">Qt 5.12.3 参考指南</a></td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">目录</a></h3>
<ul>
<li class="level1"><a href="#public-functions">公用函数</a></li>
<li class="level1"><a href="#details">详细信息</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QDesignerContainerExtension 类</h1>
<!-- $$$QDesignerContainerExtension-brief -->
<p>
<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtdesigner/qdesignercontainerextension.html">
<font style="vertical-align: inherit;">QDesignerContainerExtension</font></a><font style="vertical-align: inherit;">类可以让你的<span lang="zh-cn">页面</span>添加到Qt设计师的工作空间中的自定义多页的容器。</font><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtdesigner/qdesignercontainerextension.html#details"><font style="vertical-align: inherit;">更多...</font></a></p>
<!-- @@@QDesignerContainerExtension -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign">头文件：</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QDesignerContainerExtension&gt;</span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += designer</td></tr></table></div><ul>
<li><a href="qdesignercontainerextension-members.html">所有成员的列表，包括继承成员。</a></li>
</ul>
<a name="public-functions"></a>
<h2 id="public-functions">公用函数</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual </td><td class="memItemRight bottomAlign"><b><a href="qdesignercontainerextension.html#dtor.QDesignerContainerExtension">~QDesignerContainerExtension</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qdesignercontainerextension.html#addWidget">addWidget</a></b>(QWidget *<i>page</i>) = 0</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qdesignercontainerextension.html#canAddWidget">canAddWidget</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qdesignercontainerextension.html#canRemove">canRemove</a></b>(int <i>index</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual int </td><td class="memItemRight bottomAlign"><b><a href="qdesignercontainerextension.html#count">count</a></b>() const = 0</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual int </td><td class="memItemRight bottomAlign"><b><a href="qdesignercontainerextension.html#currentIndex">currentIndex</a></b>() const = 0</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qdesignercontainerextension.html#insertWidget">insertWidget</a></b>(int <i>index</i>, QWidget *<i>page</i>) = 0</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qdesignercontainerextension.html#remove">remove</a></b>(int <i>index</i>) = 0</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qdesignercontainerextension.html#setCurrentIndex">setCurrentIndex</a></b>(int <i>index</i>) = 0</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QWidget *</td><td class="memItemRight bottomAlign"><b><a href="qdesignercontainerextension.html#widget">widget</a></b>(int <i>index</i>) const = 0</td></tr>
</table></div>
<a name="details"></a>
<!-- $$$QDesignerContainerExtension-description -->
<div class="descr">
<h2 id="details">详细信息</h2>
<p>
<a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtdesigner/qdesignercontainerextension.html">
<font style="vertical-align: inherit;">QDesignerContainerExtension</font></a><font style="vertical-align: inherit;">类可以让你的网页添加到Qt设计师的工作空间中的自定义多页的容器。</font></p>
<p class="centerAlign"><img src="images/containerextension-example.png" alt="" /></p><p><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtdesigner/qdesignercontainerextension.html"><font style="vertical-align: inherit;">QDesignerContainerExtension</font></a><font style="vertical-align: inherit;">提供用于创建自定义容器扩展的接口。容器扩展由</font><i><font style="vertical-align: inherit;">Qt 设计师</font></i><font style="vertical-align: inherit;">管理多页面容器插件所需的一组功能和容器页面列表组成。</font></p>
<p><b><font style="vertical-align: inherit;">警告：</font></b><font style="vertical-align: inherit;">这通常</font><i><font style="vertical-align: inherit;">不是</font></i><font style="vertical-align: inherit;">容器插件的扩展，只是自定义</font><i><font style="vertical-align: inherit;">多页</font></i><font style="vertical-align: inherit;">容器。</font></p>
<p><font style="vertical-align: inherit;">要创建容器扩展，您的扩展类必须从</font><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtcore/qobject.html"><font style="vertical-align: inherit;">QObject</font></a><font style="vertical-align: inherit;">和</font><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtdesigner/qdesignercontainerextension.html"><font style="vertical-align: inherit;">QDesignerContainerExtension</font></a><font style="vertical-align: inherit;">继承。例如：</font></p>
<pre class="cpp">

  <span class="keyword">class</span> MyContainerExtension : <span class="keyword">public</span> <span class="type"><a href="../qtcore/qobject.html">QObject</a></span><span class="operator">,</span>
         <span class="keyword">public</span> <span class="type"><a href="qdesignercontainerextension.html">QDesignerContainerExtension</a></span>
  {
      Q_OBJECT
      Q_INTERFACES(<span class="type"><a href="qdesignercontainerextension.html">QDesignerContainerExtension</a></span>)

  <span class="keyword">public</span>:
      MyContainerExtension(MyCustomWidget <span class="operator">*</span>widget<span class="operator">,</span>
                           <span class="type"><a href="../qtcore/qobject.html">QObject</a></span> <span class="operator">*</span>parent <span class="operator">=</span> <span class="number">0</span>);
      <span class="type">int</span> count() <span class="keyword">const</span>;
      <span class="type"><a href="../qtwidgets/qwidget.html">QWidget</a></span> <span class="operator">*</span>widget(<span class="type">int</span> index) <span class="keyword">const</span>;
      <span class="type">int</span> currentIndex() <span class="keyword">const</span>;
      <span class="type">void</span> setCurrentIndex(<span class="type">int</span> index);
      <span class="type">void</span> addWidget(<span class="type"><a href="../qtwidgets/qwidget.html">QWidget</a></span> <span class="operator">*</span>widget);
      <span class="type">void</span> insertWidget(<span class="type">int</span> index<span class="operator">,</span> <span class="type"><a href="../qtwidgets/qwidget.html">QWidget</a></span> <span class="operator">*</span>widget);
      <span class="type">void</span> remove(<span class="type">int</span> index);

  <span class="keyword">private</span>:
      MyCustomWidget <span class="operator">*</span>myWidget;
  };

</pre>
<p>由于我们正在实现一个接口，我们必须确保使用<a href="../qtcore/qobject.html#Q_INTERFACES">Q_INTERFACES</a>()宏让元对象系统知道它。这使Qt 
Designer能够使用<a href="../qtcore/qobject.html#qobject_cast">qobject_cast</a>()函数来查询所支持的接口，只使用<a href="../qtcore/qobject.html">QObject</a>指针。</p>
<p>你必须重新实现几个功能使Qt设计器管理自定义多页面容器组件:Qt设计器使用<a href="qdesignercontainerextension.html#count">count</a>()来跟踪页面数量在你的容器,<a href="qdesignercontainerextension.html#widget">widget</a>()返回的页面在给定索引容器的列表页面,并且<a href="qdesignercontainerextension.html#currentIndex">currentIndex</a>()返回选择页面的索引列表。<i>Qt 设计师</i>使用<a href="qdesignercontainerextension.html#addWidget">addWidget</a>()函数将给定的页面添加到容器中，期望它被添加到页面列表中，而它期望<a href="qdesignercontainerextension.html#insertWidget">insertWidget</a>()函数将给定的页面插入到给定的索引中，从而将其添加到容器中。</p>
<p>在<i>Qt <span lang="zh-cn">设计师</span></i>中，只有在需要时才创建扩展。出于这个原因，您还必须创建一个<a href="qextensionfactory.html">QExtensionFactory</a>，即一个能够创建扩展实例的类，并使用Qt 
Designer的<a href="qextensionmanager.html">扩展管理器</a>注册它。</p>
<p><font style="vertical-align: inherit;">当需要容器扩展时，</font><i><font style="vertical-align: inherit;">Qt 设计师</font></i><font style="vertical-align: inherit;">的</font><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtdesigner/qextensionmanager.html"><font style="vertical-align: inherit;">扩展管理器</font></a><font style="vertical-align: inherit;">将运行所有已注册的工厂，为每个工厂调用</font><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtdesigner/qextensionfactory.html#createExtension"><font style="vertical-align: inherit;">QExtensionFactory::createExtension</font></a><font style="vertical-align: inherit;"> ()，直到找到第一个能够创建容器扩展的工厂。然后这个工厂将为插件创建扩展。</font></p>
<p><i><font style="vertical-align: inherit;">Qt 设计师 </font></i>
<font style="vertical-align: inherit;">中有四种可用的扩展类型：</font><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtdesigner/qdesignercontainerextension.html"><font style="vertical-align: inherit;">QDesignerContainerExtension</font></a><font style="vertical-align: inherit;">、</font><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtdesigner/qdesignermembersheetextension.html"><font style="vertical-align: inherit;">QDesignerMemberSheetExtension</font></a><font style="vertical-align: inherit;">、</font><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtdesigner/qdesignerpropertysheetextension.html"><font style="vertical-align: inherit;">QDesignerPropertySheetExtension</font></a><font style="vertical-align: inherit;">和</font><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtdesigner/qdesignertaskmenuextension.html"><font style="vertical-align: inherit;">QDesignerTaskMenuExtension</font></a><font style="vertical-align: inherit;">。无论请求的扩展与多页容器、成员表、属性表还是任务菜单相关联，</font><i><font style="vertical-align: inherit;">Qt 设计师</font></i><font style="vertical-align: inherit;">的行为都是相同的。</font></p>
<p><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtdesigner/qextensionfactory.html"><font style="vertical-align: inherit;">QExtensionFactory</font></a><font style="vertical-align: inherit;">类提供的标准扩展工厂，并且还可以用作用于定义扩展工厂的接口。您可以创建一个新的</font><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtdesigner/qextensionfactory.html"><font style="vertical-align: inherit;">QExtensionFactory</font></a><font style="vertical-align: inherit;">并重新实现</font><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtdesigner/qextensionfactory.html#createExtension"><font style="vertical-align: inherit;">QExtensionFactory::createExtension</font></a><font style="vertical-align: inherit;"> () 函数。例如：</font></p>
<pre class="cpp">

  <span class="type"><a href="../qtcore/qobject.html">QObject</a></span> <span class="operator">*</span>ANewExtensionFactory<span class="operator">::</span>createExtension(<span class="type"><a href="../qtcore/qobject.html">QObject</a></span> <span class="operator">*</span>object<span class="operator">,</span>
          <span class="keyword">const</span> <span class="type"><a href="../qtcore/qstring.html">QString</a></span> <span class="operator">&amp;</span>iid<span class="operator">,</span> <span class="type"><a href="../qtcore/qobject.html">QObject</a></span> <span class="operator">*</span>parent) <span class="keyword">const</span>
  {
      <span class="keyword">if</span> (iid <span class="operator">!</span><span class="operator">=</span> Q_TYPEID(<span class="type"><a href="qdesignercontainerextension.html">QDesignerContainerExtension</a></span>))
          <span class="keyword">return</span> <span class="number">0</span>;

      <span class="keyword">if</span> (MyCustomWidget <span class="operator">*</span>widget <span class="operator">=</span> qobject_cast<span class="operator">&lt;</span>MyCustomWidget<span class="operator">*</span><span class="operator">&gt;</span>
             (object))
          <span class="keyword">return</span> <span class="keyword">new</span> MyContainerExtension(widget<span class="operator">,</span> parent);

      <span class="keyword">return</span> <span class="number">0</span>;
  }

</pre>
<p><font style="vertical-align: inherit;">或者您可以使用现有工厂，扩展</font><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtdesigner/qextensionfactory.html#createExtension"><font style="vertical-align: inherit;">QExtensionFactory::createExtension</font></a><font style="vertical-align: inherit;"> () 函数，使工厂也能够创建容器扩展。例如：</font></p>
<pre class="cpp">

  <span class="type"><a href="../qtcore/qobject.html">QObject</a></span> <span class="operator">*</span>AGeneralExtensionFactory<span class="operator">::</span>createExtension(<span class="type"><a href="../qtcore/qobject.html">QObject</a></span> <span class="operator">*</span>object<span class="operator">,</span>
          <span class="keyword">const</span> <span class="type"><a href="../qtcore/qstring.html">QString</a></span> <span class="operator">&amp;</span>iid<span class="operator">,</span> <span class="type"><a href="../qtcore/qobject.html">QObject</a></span> <span class="operator">*</span>parent) <span class="keyword">const</span>
  {
      MyCustomWidget <span class="operator">*</span>widget <span class="operator">=</span> qobject_cast<span class="operator">&lt;</span>MyCustomWidget<span class="operator">*</span><span class="operator">&gt;</span>(object);

      <span class="keyword">if</span> (widget <span class="operator">&amp;</span><span class="operator">&amp;</span> (iid <span class="operator">=</span><span class="operator">=</span> Q_TYPEID(<span class="type"><a href="qdesignertaskmenuextension.html">QDesignerTaskMenuExtension</a></span>))) {
          <span class="keyword">return</span> <span class="keyword">new</span> MyTaskMenuExtension(widget<span class="operator">,</span> parent);

      } <span class="keyword">else</span> <span class="keyword">if</span> (widget <span class="operator">&amp;</span><span class="operator">&amp;</span> (iid <span class="operator">=</span><span class="operator">=</span> Q_TYPEID(<span class="type"><a href="qdesignercontainerextension.html">QDesignerContainerExtension</a></span>))) {
          <span class="keyword">return</span> <span class="keyword">new</span> MyContainerExtension(widget<span class="operator">,</span> parent);

      } <span class="keyword">else</span> {
          <span class="keyword">return</span> <span class="number">0</span>;
      }
  }

</pre>
<p><font style="vertical-align: inherit;">有关使用</font><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtdesigner/qdesignercontainerextension.html"><font style="vertical-align: inherit;">QDesignerContainerExtension</font></a><font style="vertical-align: inherit;">类的完整示例，请参阅</font><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtdesigner/qtdesigner-containerextension-example.html"><font style="vertical-align: inherit;">容器扩展示例</font></a><font style="vertical-align: inherit;">。该示例展示了如何为</font><i><font style="vertical-align: inherit;">Qt 设计师</font></i><font style="vertical-align: inherit;">创建自定义多页插件。</font></p>
</div>
<p><b><font style="vertical-align: inherit;">请参考</font></b><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtdesigner/qextensionfactory.html"><font style="vertical-align: inherit;">QExtensionFactory</font></a><font style="vertical-align: inherit;">、</font><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtdesigner/qextensionmanager.html"><font style="vertical-align: inherit;">QExtensionManager</font></a><font style="vertical-align: inherit;">和</font><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtdesigner/designer-creating-custom-widgets-extensions.html"><font style="vertical-align: inherit;">创建自定义组件扩展</font></a><font style="vertical-align: inherit;">。</font></p>
<!-- @@@QDesignerContainerExtension -->
<div class="func">
<h2>成员函数文档</h2>
<!-- $$$~QDesignerContainerExtension[overload1]$$$~QDesignerContainerExtension -->
<h3 class="fn" id="dtor.QDesignerContainerExtension"><a name="dtor.QDesignerContainerExtension"></a><code>[virtual] </code>QDesignerContainerExtension::<span class="name">~QDesignerContainerExtension</span>()</h3>
<p><font style="vertical-align: inherit;">销毁扩展。</font></p>
<!-- @@@~QDesignerContainerExtension -->
<!-- $$$addWidget[overload1]$$$addWidgetQWidget* -->
<h3 class="fn" id="addWidget"><a name="addWidget"></a><code>[pure virtual] </code><span class="type">void</span> QDesignerContainerExtension::<span class="name">addWidget</span>(<span class="type"><a href="../qtwidgets/qwidget.html">QWidget</a></span> *<i>page</i>)</h3>
<p><font style="vertical-align: inherit;">通过将给定</font><i><font style="vertical-align: inherit;">page<span lang="zh-cn">（</span>页面<span lang="zh-cn">）</span></font></i><font style="vertical-align: inherit;">附加到扩展的页面列表，将给定<i>page<span lang="zh-cn">（</span>页面<span lang="zh-cn">）</span></i>添加到容器中。</font></p>
<p><b><font style="vertical-align: inherit;">请参考</font></b><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtdesigner/qdesignercontainerextension.html#insertWidget"><font style="vertical-align: inherit;">insertWidget</font></a><font style="vertical-align: inherit;"> ()、</font><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtdesigner/qdesignercontainerextension.html#remove"><font style="vertical-align: inherit;">remove</font></a><font style="vertical-align: inherit;"> ()和</font><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtdesigner/qdesignercontainerextension.html#widget"><font style="vertical-align: inherit;">widget</font></a><font style="vertical-align: inherit;"> ()。</font></p>
<!-- @@@addWidget -->
<!-- $$$canAddWidget[overload1]$$$canAddWidget -->
<h3 class="fn" id="canAddWidget"><a name="canAddWidget"></a><code>[virtual] </code><span class="type">bool</span> QDesignerContainerExtension::<span class="name">canAddWidget</span>() const</h3>
<p><font style="vertical-align: inherit;">返回是否可以添加组件。这确定是否启用添加或插入页面的上下文菜单选项。</font></p>
<p><font style="vertical-align: inherit;">对于具有单个固定页面的容器，例如</font><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtwidgets/qscrollarea.html"><font style="vertical-align: inherit;">QScrollArea</font></a><font style="vertical-align: inherit;">或</font><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtwidgets/qdockwidget.html"><font style="vertical-align: inherit;">QDockWidget</font></a><font style="vertical-align: inherit;">，这应该返回 false 。</font></p>
<p><font style="vertical-align: inherit;">这个函数是在 Qt 5.0 中引入的。</font></p>
<p><b><font style="vertical-align: inherit;">请参考</font></b><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtdesigner/qdesignercontainerextension.html#addWidget"><font style="vertical-align: inherit;">addWidget</font></a><font style="vertical-align: inherit;"> ()和</font><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtdesigner/qdesignercontainerextension.html#canRemove"><font style="vertical-align: inherit;">canRemove</font></a><font style="vertical-align: inherit;"> ()。</font></p>
<!-- @@@canAddWidget -->
<!-- $$$canRemove[overload1]$$$canRemoveint -->
<h3 class="fn" id="canRemove"><a name="canRemove"></a><code>[virtual] </code><span class="type">bool</span> QDesignerContainerExtension::<span class="name">canRemove</span>(<span class="type">int</span> <i>index</i>) const</h3>
<p><font style="vertical-align: inherit;">返回是否可以删除给定</font><i><font style="vertical-align: inherit;">index 
（索引</font></i><font style="vertical-align: inherit;">）处的组件。这确定是否启用删除当前页面的上下文菜单选项。</font></p>
<p><font style="vertical-align: inherit;">对于具有单个固定页面的容器，例如</font><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtwidgets/qscrollarea.html"><font style="vertical-align: inherit;">QScrollArea</font></a><font style="vertical-align: inherit;">或</font><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtwidgets/qdockwidget.html"><font style="vertical-align: inherit;">QDockWidget</font></a><font style="vertical-align: inherit;">，这应该返回 false 。</font></p>
<p><font style="vertical-align: inherit;">这个函数是在 Qt 5.0 中引入的。</font></p>
<p><b><font style="vertical-align: inherit;">请参考</font></b><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtdesigner/qdesignercontainerextension.html#remove"><font style="vertical-align: inherit;">remove</font></a><font style="vertical-align: inherit;"> ()和</font><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtdesigner/qdesignercontainerextension.html#canAddWidget"><font style="vertical-align: inherit;">canAddWidget</font></a><font style="vertical-align: inherit;"> ()。</font></p>
<!-- @@@canRemove -->
<!-- $$$count[overload1]$$$count -->
<h3 class="fn" id="count"><a name="count"></a><code>[pure virtual] </code><span class="type">int</span> QDesignerContainerExtension::<span class="name">count</span>() const</h3>
<p><font style="vertical-align: inherit;">返回容器中的页数。</font></p>
<!-- @@@count -->
<!-- $$$currentIndex[overload1]$$$currentIndex -->
<h3 class="fn" id="currentIndex"><a name="currentIndex"></a><code>[pure virtual] </code><span class="type">int</span> QDesignerContainerExtension::<span class="name">currentIndex</span>() const</h3>
<p><font style="vertical-align: inherit;">返回容器中当前选定页面的索引。</font></p>
<p><b>请参考 </b><a href="qdesignercontainerextension.html#setCurrentIndex">setCurrentIndex</a>()<span lang="zh-cn">。</span></p>
<!-- @@@currentIndex -->
<!-- $$$insertWidget[overload1]$$$insertWidgetintQWidget* -->
<h3 class="fn" id="insertWidget"><a name="insertWidget"></a><code>[pure virtual] </code><span class="type">void</span> QDesignerContainerExtension::<span class="name">insertWidget</span>(<span class="type">int</span> <i>index</i>, <span class="type"><a href="../qtwidgets/qwidget.html">QWidget</a></span> *<i>page</i>)</h3>
<p><font style="vertical-align: inherit;">通过将给定</font><i><font style="vertical-align: inherit;"><span lang="zh-cn">page（</span>页面<span lang="zh-cn">）</span></font></i><font style="vertical-align: inherit;">插入到扩展的页面列表中的给定</font><i><font style="vertical-align: inherit;">index<span lang="zh-cn">（</span>索引<span lang="zh-cn">）</span></font></i><font style="vertical-align: inherit;">处，将给定<i>page<span lang="zh-cn">(</span>页面<span lang="zh-cn">)</span></i>添加到容器中。</font></p>
<p><b><font style="vertical-align: inherit;">请参考</font></b><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtdesigner/qdesignercontainerextension.html#addWidget"><font style="vertical-align: inherit;">addWidget</font></a><font style="vertical-align: inherit;"> ()、</font><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtdesigner/qdesignercontainerextension.html#remove"><font style="vertical-align: inherit;">remove</font></a><font style="vertical-align: inherit;"> ()和</font><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtdesigner/qdesignercontainerextension.html#widget"><font style="vertical-align: inherit;">widget</font></a><font style="vertical-align: inherit;"> ()。</font></p>
<!-- @@@insertWidget -->
<!-- $$$remove[overload1]$$$removeint -->
<h3 class="fn" id="remove"><a name="remove"></a><code>[pure virtual] </code><span class="type">void</span> QDesignerContainerExtension::<span class="name">remove</span>(<span class="type">int</span> <i>index</i>)</h3>
<p><font style="vertical-align: inherit;">从扩展的页面列表中删除给定<i>index<span lang="zh-cn">(</span></i></font><i><font style="vertical-align: inherit;">索引<span lang="zh-cn">)</span></font></i><font style="vertical-align: inherit;">处的页面。</font></p>
<p><b><font style="vertical-align: inherit;">请参考</font></b><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtdesigner/qdesignercontainerextension.html#addWidget"><font style="vertical-align: inherit;">addWidget</font></a><font style="vertical-align: inherit;"> ()和</font><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtdesigner/qdesignercontainerextension.html#insertWidget"><font style="vertical-align: inherit;">insertWidget</font></a><font style="vertical-align: inherit;"> ()。</font></p>
<!-- @@@remove -->
<!-- $$$setCurrentIndex[overload1]$$$setCurrentIndexint -->
<h3 class="fn" id="setCurrentIndex"><a name="setCurrentIndex"></a><code>[pure virtual] </code><span class="type">void</span> QDesignerContainerExtension::<span class="name">setCurrentIndex</span>(<span class="type">int</span> <i>index</i>)</h3>
<p><font style="vertical-align: inherit;">将容器中当前选定的页面设置为扩展的页面列表中给定</font><i><font style="vertical-align: inherit;">index<span lang="zh-cn">(</span>索引<span lang="zh-cn">)</span></font></i><font style="vertical-align: inherit;">处的页面。</font></p>
<p><b>请参考 </b><a href="qdesignercontainerextension.html#currentIndex">currentIndex</a>()<span lang="zh-cn">。</span></p>
<!-- @@@setCurrentIndex -->
<!-- $$$widget[overload1]$$$widgetint -->
<h3 class="fn" id="widget"><a name="widget"></a><code>[pure virtual] </code><span class="type"><a href="../qtwidgets/qwidget.html">QWidget</a></span> *QDesignerContainerExtension::<span class="name">widget</span>(<span class="type">int</span> <i>index</i>) const</h3>
<p><font style="vertical-align: inherit;">返回扩展的页面列表中给定</font><i><font style="vertical-align: inherit;">index<span lang="zh-cn">（</span>索引<span lang="zh-cn">）</span>处</font></i><font style="vertical-align: inherit;">的页面。</font></p>
<p><b><font style="vertical-align: inherit;">请参考</font></b><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtdesigner/qdesignercontainerextension.html#addWidget"><font style="vertical-align: inherit;">addWidget</font></a><font style="vertical-align: inherit;"> ()和</font><a href="file:///E:/WLL/work/Qt5.12-Document-Trans-in-Chinese/qtdesigner/qdesignercontainerextension.html#insertWidget"><font style="vertical-align: inherit;">insertWidget</font></a><font style="vertical-align: inherit;"> ()。</font></p>
<!-- @@@widget -->
</div>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2019 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br/>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br/>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>
